"""
__author__ = 'berlinyoung'
@File   :contact_page.py
@Date   :2022/5/18 20:48
-*- coding: utf-8 -*-
"""
import time

from appium.webdriver.common.mobileby import MobileBy

from weixin_mobile.step1_po.page.base import Base
from weixin_mobile.step1_po.page.contact_addmember_page import AddMemberPage
from weixin_mobile.step1_po.page.private_info import PrivateInfo


class ContactPage(Base):

    def goto_addmember(self):
        self.swipe_find('添加成员').click()
        return AddMemberPage(self.driver)

    def goto_private_info(self,name):
        self.swipe_find(name).click()
        return PrivateInfo(self.driver)

    def get_list_member(self,name):
        time.sleep(2)
        list = []
        eles = self.finds(MobileBy.XPATH,f"//*[@text='{name}']")
        for i in eles:
            list.append(i.text)
        return len(list)